package com.struts2.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.struts2.model.Category;
import com.struts2.model.Designer;
import com.struts2.model.Gender;
import com.struts2.model.Product_item;
import com.struts2.model.Product_line;
import com.struts2.model.Season;
import com.struts2.model.Type;
import com.struts2.service.AdminService;

public class AdminProductDetailAction extends ActionSupport implements ModelDriven<Product_line>{

	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Product_line product_line;
	
	private List<Product_item> product_items;
	private List<Season> seasonList;
	private List<Gender> genderList;
	private List<Type> typeList;
	private List<Category> categoryList;
	
	private List<Designer> designerList;
	
	
	private int yourSeason;
	private int yourGender;
	private int yourType=-1;
	private int yourCategory;
	private int yourDesigner;
	
	
	private int id;
	private String name;
	private int price;
	
	public String execute() {
		AdminService as = new AdminService();
		product_line = as.getProduct_line(id);
		
		product_items = as.getProduct_items(product_line);
		return SUCCESS;
	}

	public String Edit()
	{
		AdminService as = new AdminService();
		product_line = as.getProduct_line(id);
		seasonList = as.getSeasonList();
		genderList= as.getGenderList();
		typeList= as.getTypeList();
		categoryList= as.getCategoryList();
		designerList= as.getDesignerList();
		
		return SUCCESS;
	}
	
	public String Save()
	{
		AdminService as = new AdminService();
		as.setProduct(id,name,price,yourSeason,yourGender,yourType,yourCategory,yourDesigner);
		
		product_line = as.getProduct_line(id);
		product_items = as.getProduct_items(product_line);
		
		return SUCCESS;
	}
	
	public String GenderChange()
	{
		return SUCCESS;
	}
	
	
	@Override
	public Product_line getModel() {
		// TODO Auto-generated method stub
		
		return null;
	}

	
	
	
	
	
	

	// /************************************************************************************************************
	public Product_line getProduct_line() {
		return product_line;
	}

	public void setProduct_line(Product_line product_line) {
		this.product_line = product_line;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public List<Product_item> getProduct_items() {
		return product_items;
	}

	public void setProduct_items(List<Product_item> product_items) {
		this.product_items = product_items;
	}

	public List<Season> getSeasonList() {
		return seasonList;
	}

	public void setSeasonList(List<Season> seasonList) {
		this.seasonList = seasonList;
	}

	public int getYourSeason() {
		return yourSeason;
	}

	public void setYourSeason(int yourSeason) {
		this.yourSeason = yourSeason;
	}

	public List<Gender> getGenderList() {
		return genderList;
	}

	public void setGenderList(List<Gender> genderList) {
		this.genderList = genderList;
	}

	public List<Type> getTypeList() {
		return typeList;
	}

	public void setTypeList(List<Type> typeList) {
		this.typeList = typeList;
	}

	public List<Category> getCategoryList() {
		return categoryList;
	}

	public void setCategoryList(List<Category> categoryList) {
		this.categoryList = categoryList;
	}

	public List<Designer> getDesignerList() {
		return designerList;
	}

	public void setDesignerList(List<Designer> designerList) {
		this.designerList = designerList;
	}

	public int getYourGender() {
		return yourGender;
	}

	public void setYourGender(int yourGender) {
		this.yourGender = yourGender;
	}

	public int getYourType() {
		return yourType;
	}

	public void setYourType(int yourType) {
		this.yourType = yourType;
	}

	public int getYourCategory() {
		return yourCategory;
	}

	public void setYourCategory(int yourCategory) {
		this.yourCategory = yourCategory;
	}

	public int getYourDesigner() {
		return yourDesigner;
	}

	public void setYourDesigner(int yourDesigner) {
		this.yourDesigner = yourDesigner;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	// *//////////////////////////////////////
	
}
